package com.zs.toolbox.web2j.system.core.converts;

import com.zs.toolbox.web2j.common.web.WtCommonPropertiesSetter;
import com.zs.toolbox.web2j.system.core.entity.WtUserEntity;
import com.zs.toolbox.web2j.system.core.request.WtRegisterByUsernameAndPasswordReqeust;
import org.springframework.beans.BeanUtils;

/**
 * @author shuai.zhang  on 2018/9/22
 * @description
 */
public class WtUserConverters {
    public static WtUserEntity convertToNewWtUserEntitiy(WtRegisterByUsernameAndPasswordReqeust reqeust) {
        WtUserEntity target = new WtUserEntity();
        WtCommonPropertiesSetter.setDefaultCommonProperty(target);
        target.setNickname(String.valueOf(System.currentTimeMillis()));
        target.setUsername(String.valueOf(System.currentTimeMillis()));
        BeanUtils.copyProperties(reqeust,target);
        return target;
    }
}
